* (T115414) The $wgEnableAPI and $wgEnableWriteAPI settings, deprecated in 1.31, have been removed.
* The $wgUseAjax setting, deprecated in 1.31, is now ignored.
* The $wgSiteSupportPage setting, unused since 1.5, was removed.
+* $wgJpegQuality was added to allow configuring the quality of JPEG thumbnails (default 80).
+* The default quality of JPEG thumbnails generated by GD was reduced from 95 to 80.
* …
=== New features in 1.32 ===
protected function transformImageMagick( $image, $params ) {
# use ImageMagick
global $wgSharpenReductionThreshold, $wgSharpenParameter, $wgMaxAnimatedGifArea,
- $wgImageMagickTempDir, $wgImageMagickConvertCommand, $wgJpegPixelFormat;
+ $wgImageMagickTempDir, $wgImageMagickConvertCommand, $wgJpegPixelFormat,
+ $wgJpegQuality;
$quality = [];
$sharpen = [];
if ( $params['mimeType'] == 'image/jpeg' ) {
$qualityVal = isset( $params['quality'] ) ? (string)$params['quality'] : null;
- $quality = [ '-quality', $qualityVal ?: '80' ]; // 80%
+ $quality = [ '-quality', $qualityVal ?: (string)$wgJpegQuality ]; // 80% by default
if ( $params['interlace'] ) {
$animation_post = [ '-interlace', 'JPEG' ];
}
*/
protected function transformImageMagickExt( $image, $params ) {
global $wgSharpenReductionThreshold, $wgSharpenParameter, $wgMaxAnimatedGifArea,
- $wgJpegPixelFormat;
+ $wgJpegPixelFormat, $wgJpegQuality;
try {
$im = new Imagick();
$im->sharpenImage( $radius, $sigma );
}
$qualityVal = isset( $params['quality'] ) ? (string)$params['quality'] : null;
- $im->setCompressionQuality( $qualityVal ?: 80 );
+ $im->setCompressionQuality( $qualityVal ?: $wgJpegQuality );
if ( $params['interlace'] ) {
$im->setInterlaceScheme( Imagick::INTERLACE_JPEG );
}
/**
* Callback for transformGd when transforming jpeg images.
+ *
+ * @param resource $dst_image Image resource of the original image
+ * @param string $thumbPath File path to write the thumbnail image to
+ * @param int|null $quality Quality of the thumbnail from 1-100,
+ * or null to use default quality.
*/
- // FIXME: transformImageMagick() & transformImageMagickExt() uses JPEG quality 80, here it's 95?
- static function imageJpegWrapper( $dst_image, $thumbPath, $quality = 95 ) {
+ static function imageJpegWrapper( $dst_image, $thumbPath, $quality = null ) {
+ global $wgJpegQuality;
+
+ if ( $quality === null ) {
+ $quality = $wgJpegQuality;
+ }
+
imageinterlace( $dst_image );
imagejpeg( $dst_image, $thumbPath, $quality );
}